<!DOCTYPE html>
<html lang="zh-CN" style="height:100%">
<%@ page language="java" import="com.siysoft.tc.base.bean.to.User" pageEncoding="UTF-8"%> 	
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
<title>注册页面</title>

    <!-- Bootstrap -->
<link href="<%=request.getContextPath()%>/common/css/bootstrap.min.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]--> 
    
    
    <link href="<%=request.getContextPath()%>/common/css/base.css" rel="stylesheet" type="text/css">
	<script>
	function setImagePreview(fileId, showImagesId) {  
		toShowLoading();
		var preview, img_txt, localImag, file_head = document.getElementById(fileId),  
		picture = file_head.value; 
		if(picture == ''){
			preview = document.getElementById(showImagesId);
			preview.src = "<%=request.getContextPath()%>/common/images/teacher2.jpg";
		}
		if (!picture.match(/.jpg|.png|.bmp/i) && picture != '') return alert("您上传的图片格式不正确，请重新选择！"),  
		!1;  
		if (preview = document.getElementById(showImagesId), file_head.files && file_head.files[0]){
				preview.style.display = "block",
	            preview.style.height = $("#" + showImagesId).height() + "px",  
				preview.src = window.navigator.userAgent.indexOf("Chrome") >= 1 || window.navigator.userAgent.indexOf("Safari") >= 1 ?  window.webkitURL.createObjectURL(file_head.files[0]) : window.URL.createObjectURL(file_head.files[0]); 
				var tmpCanvas = document.getElementById("canvas_tmp");
				var tmpContext = tmpCanvas.getContext("2d");
				
				var image = document.getElementById("idCardFrontImg");
				
				var reader = new FileReader();
	
				reader.onload = function(evt) {
					image.src = evt.target.result;
				
					var hideImg = document.getElementById("hideImg");
					hideImg.src = evt.target.result;				
					
					hideImg.onload = function(){
				        // canvas清屏  
				        tmpContext.clearRect(0, 0, tmpCanvas.width, tmpCanvas.height);  
				        // 重置canvas宽高  
				        tmpCanvas.width = hideImg.width;  
				        tmpCanvas.height = hideImg.height;  
				        // 将图像绘制到canvas上  
				        tmpContext.drawImage(hideImg, 0, 0, hideImg.width, hideImg.height);
					    var Pic = document.getElementById("canvas_tmp").toDataURL("image/png");
						Pic = Pic.replace(/^data:image\/(png|jpg);base64,/, "");
						$("#fixedAvatar").val(Pic);
						toHideLoading();
					}
	
				}
				reader.readAsDataURL(file_head.files[0]);
		}
	}
	
	</script>

</head>
  <body class="start-body">
  
 <div class="main_01"style="margin-bottom:0;border-bottom: 1px dashed   #e0e0e0; ">
				<div id="label_1" style="padding-left:0%;width: 100%">
					<img class="default" src="" id="idCardFrontImg" name="idCardFrontImg" width="100%">
					<div class="fileUpload_div">
						<input type="file" class="fileUpload_class" id="picture" name="picture" data-role="none" class="input" required onchange="javascript:setImagePreview(this.id,'idCardFrontImg');"/>
					</div>
					上传照片(照片请小于1M)
				</div>
				<input type="hidden" id="fixedAvatar" name="fixedAvatar" />
					<canvas id="canvas_tmp" style="position: absolute;left: -99999px;"></canvas>
					<div><img id="hideImg" style="position: absolute;left: -99999px;"/></div>
					
				<div class="clearfix"></div>
			</div>
 
    
    

  </body>
</html>